#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;




struct Base{

private:
	struct Node{
		Node(int L, Node * sb)
		{
			Node();
			len = L;
			sub = sb;
		}
		Node()
		{
			for(int i = 0; i < 26; i++)
			{
				to[i] = NULL;
			}
			sub = NULL;
			len = 0;
		}
		int len;
		Node * sub;
		Node * to[26];
		Node *& go(char c)
		{
			return to[c - 'a'];
		}

		Node * getNextSuf(Base * base)
		{
			
			Node * cur = this;
			if(cur == NULL) return &base->node[1];
			while(base->s[base->n] != base->s[base->n - cur->len - 1] ) cur = cur->sub;
			return cur;
		}	
	
	};

	Node node[100500];
	char s[100500];
	Node * first;
	int size, n;




public:
	Base()
	{
		node[0].len = -2;
		node[1].len = -1, node[2].sub = &node[1], s[0] = '#', n = 0, first = &node[2], size = 3;
	}
	
	
	Node * newNode(int L, Node * sb)
	{
		return & (node[size++] = Node(L, sb) );
	}

	int addLetter(char c)
	{
		s[++n] = c;
		first = first->getNextSuf(this);
		Node * newSecond = first -> sub -> getNextSuf(this) -> go( c );
		Node *& newFirst = first -> go( c );
		if(newFirst == NULL )
		{
			newFirst = newNode(first->len + 2, newSecond ? newSecond : &node[2]);
		}
		first = newFirst;
		return size - 3;
	}
} base;



char S[100500];

int main()
{	
	scanf("%s", S + 1);
	int N = strlen(S + 1);
	for(int i = 1; i <= N; i++)
	{
		int res = base.addLetter(S[i]);
		printf("%d\n", res);
	}
	return 0;
}